package com.sdp.wz.excel;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sdp.right.excel.importExcel.ImportExcelCallbackService;
import com.sdp.wz.db.wz_input_detail.entity.WzInputDetail;
import com.sdp.wz.db.wz_input_detail.service.IWzInputDetailService;

@Service
public class WzInputDetailImportBefore implements ImportExcelCallbackService{
	
	@Autowired
	private IWzInputDetailService iWzInputDetailService;

	@Override
	@Transactional(rollbackFor=Exception.class)
	public void execute(HttpServletRequest request, HttpServletResponse response) {
		String imoprtParameter = request.getParameter("imoprtParameter");
		String inputCode = JSON.parseObject(imoprtParameter).getString("inputCode");
		LambdaQueryWrapper<WzInputDetail> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(WzInputDetail::getInputCode, inputCode);
		iWzInputDetailService.remove(queryWrapper);
		
	}

}
